package com.e3.web.core.server;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.e3.core.base.ServiceLocator;
import com.e3.core.cache.CacheManager;
import com.e3.core.life.ApplicationLifecycleManager;
import com.e3.sysmg.security.server.UserHelper;

public class SystemInitializationServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4490840854044401373L;

	@Override
	public void init(ServletConfig config) throws ServletException {
		super.init(config);

		initApplication();
		startApplication();
	}

	private void initApplication() {
		System.getProperties().put("logback.configurationFile","/conf/logback.xml");
		ServiceLocator.init();
		ApplicationLifecycleManager.init();
		CacheManager.init();
		UserHelper.init();
	}

	private void startApplication() {
		ApplicationLifecycleManager.start();
	}

}
